﻿using System;
using System.ComponentModel;
using System.Drawing.Design;
using StockSharp.Logging;
using OpenQuant.Quik.Design;
using System.IO;

namespace OpenQuant.Quik
{
    [Serializable]
    [TypeConverter(typeof (ExpandableObjectConverter))]
    public class LogSettings
    {
        [Description("Следует ли использовать логирование")]
        public bool Enabled { get; set; }

        string _path = string.Empty;
        [Description("Полный путь к лог-файлу")]
        [Editor(typeof(LogFileNameEditor), typeof(UITypeEditor))]
        public string Path
        {
            get { return _path; }
            set { _path = (File.Exists(value)) ? value : string.Empty; }
        }

        [Description("Уровни лог-сообщений")]
        public LogLevels LogLevel { get; set; }

        public override string ToString()
        {
            return string.Format("Log [Enabled={0};LogLevel={1}]", Enabled, LogLevel);
        }
    }
}
